package avicit.bdp.dds.remote.command.log;

import avicit.bdp.dds.remote.command.Command;
import avicit.bdp.dds.remote.command.CommandType;
import avicit.bdp.dds.remote.utils.FastJsonSerializer;

import java.io.Serializable;

/**
 *  get log bytes response command
 */
public class GetLogBytesResponseCommand implements Serializable {

    /**
     *  log byte data
     */
    private byte[] data;

    public GetLogBytesResponseCommand() {
    }

    public GetLogBytesResponseCommand(byte[] data) {
        this.data = data;
    }

    public byte[] getData() {
        return data;
    }

    public void setData(byte[] data) {
        this.data = data;
    }

    /**
     * package response command
     *
     * @param opaque request unique identification
     * @return command
     */
    public Command convert2Command(long opaque){
        Command command = new Command(opaque);
        command.setType(CommandType.GET_LOG_BYTES_RESPONSE);
        byte[] body = FastJsonSerializer.serialize(this);
        command.setBody(body);
        return command;
    }

}
